package com.duguo.dynamicmvc.demo.accounts;

import com.duguo.dynamicmvc.model.Model;
import com.duguo.dynamicmvc.model.statusmessage.StatusMessage;
import com.duguo.dynamicmvc.model.statusmessage.StatusMessageImpl;
import com.duguo.dynamicmvc.model.statusmessage.StatusMessageModel;
import com.duguo.dynamicmvc.support.ModelAndView;
import com.duguo.dynamicmvc.support.ModelAndViewImpl;
import com.duguo.dynamicmvc.view.forward.ForwardView;

public class AccountsHelper{

    public static ModelAndView forwardToLoginPage(StatusMessageModel model,String loginViewName){
    	StatusMessage statusMessage=new StatusMessageImpl(2,"Login required","Please login to access the resource!");
    	model.addStatusMessage(statusMessage);
    	return new ModelAndViewImpl((Model)model,new ForwardView(loginViewName));
    }
}
